package com.bbex.entity;

import com.bbex.config.CustomLocalDateTimeSerializer;
import com.bbex.sql.PrimaryKey;
import com.bbex.sql.SqlField;
import com.bbex.sql.SqlTable;
import com.bbex.vo.SourceAddressVO;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.time.LocalDateTime;
import java.util.UUID;

/**
 * 用户coin 充币来源地址管理
 */
@SqlTable("hongmeng_user_source_address")
public class SourceAddress {
    private static final long serialVersionUID = 1L;

    public static final int STATUS_ENABLE = 1;
    public static final int STATUS_DISABLE = 0;


    @PrimaryKey(insertIsSkip = false)
    @SqlField("id")
    protected String id;
    @SqlField("user_id")
    private String userId;
    @SqlField("coin_symbol")
    private String coinSymbol;
    @SqlField("address")
    private String address;

    /**
     * 状态0=不可用, 1=可用
     */
    @SqlField("status")
    private Integer status;
    @SqlField("coin_type")
    private String coinType;
    @SqlField("check_value")
    private String checkValue;

    @SqlField("check_expire_date")
    @JsonSerialize(using = CustomLocalDateTimeSerializer.class)
    protected LocalDateTime checkExpireDate;
    @SqlField("create_date")
    @JsonSerialize(using = CustomLocalDateTimeSerializer.class)
    protected LocalDateTime createDate;
    @SqlField("update_date")
    @JsonSerialize(using = CustomLocalDateTimeSerializer.class)
    protected LocalDateTime updateDate;

    public SourceAddress() {

    }

    public SourceAddress(SourceAddressVO sourceAddressVo) {
        this.id = UUID.randomUUID().toString();
        this.userId = sourceAddressVo.getUserId();
        this.address = sourceAddressVo.getAddress();
        this.coinSymbol = sourceAddressVo.getCoinSymbol();
        this.checkValue = sourceAddressVo.getCheckValue();
        this.status = SourceAddress.STATUS_DISABLE;
        this.createDate = LocalDateTime.now();
        this.updateDate = LocalDateTime.now();
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public LocalDateTime getCreateDate() {
        return createDate;
    }

    public void setCreateDate(LocalDateTime createDate) {
        this.createDate = createDate;
    }

    public LocalDateTime getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(LocalDateTime updateDate) {
        this.updateDate = updateDate;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCoinSymbol() {
        return coinSymbol;
    }

    public void setCoinSymbol(String coinSymbol) {
        this.coinSymbol = coinSymbol;
    }

    public String getCoinType() {
        return coinType;
    }

    public void setCoinType(String coinType) {
        this.coinType = coinType;
    }

    public String getCheckValue() {
        return checkValue;
    }

    public void setCheckValue(String checkValue) {
        this.checkValue = checkValue;
    }

    public LocalDateTime getCheckExpireDate() {
        return checkExpireDate;
    }

    public void setCheckExpireDate(LocalDateTime checkExpireDate) {
        this.checkExpireDate = checkExpireDate;
    }
}
